package com.qk.exception;

import com.qk.enums.Code;

/**
 * @Author: zhangchuang
 * @Date: 2025/10/10 19:30
 * @Description: 通用异常工具类
 */
@SuppressWarnings("all")
public class CommonException extends BaseException {

    public CommonException(Code code) {
        super(code.getMessage());
    }
    public CommonException(Exception e) {
        super(e.getMessage());
    }

    /**
     * 通用抛出异常
     *
     * @param code 枚举
     */
    public static void throwException(Code code) {
        throw new CommonException(code);
    }

    public static void throwException(Exception e) {
        throw new CommonException(e);
    }

}
